﻿using IntelligentAgriculture.Contracts.Interface.SheepFileModelInterface;
using IntelligentAgriculture.WebAPI.Application.Command.SheepfilemodelCommand;
using MediatR;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.SheepfilemodelCommandHandler
{
    public class SheepfilemodelUpdateCommandHandler :  IRequestHandler<SheepfilemodelUpdateCommand, Results<int>>
    {
        private readonly ISheepFileModelService _sheepFileModelService;
        public SheepfilemodelUpdateCommandHandler(ISheepFileModelService sheepFileModelService)
        {
            _sheepFileModelService = sheepFileModelService;
        }
        public async Task<Results<int>> Handle(SheepfilemodelUpdateCommand request, CancellationToken cancellationToken)
        {
            var result = await _sheepFileModelService.UpdaSheepfilemodel(request.SheepfileModelInput);
            return Results<int>.DataResult(result);
        }
    }
}
